import React, { PureComponent, createRef } from 'react'

export class App extends PureComponent {
  constructor() {
    super()
    this.state = {}

    this.inpRef = createRef()
  }

  formSubmit(e) {
    console.log(this.inpRef.current.value)

    e.preventDefault()
  }

  render() {
    return (
      <div>
        <form onSubmit={(e) => this.formSubmit(e)}>
          <input type="text" ref={this.inpRef} />
          <div>
            <button>提交</button>
          </div>
        </form>
      </div>
    )
  }
}

export default App
